from http.server import HTTPServer, SimpleHTTPRequestHandler

def main():
    # 将当前目录设置为服务器的根目录
    port = 8000
    httpd = HTTPServer(('localhost', port), SimpleHTTPRequestHandler)
    print(f"Starting httpd server on port {port}")

    # 开始监听HTTP请求
    httpd.serve_forever()

if __name__ == '__main__':
    main()